<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
<link href="./css/common.css" rel="stylesheet"  />
<link href="../../css/buttons.css" rel="stylesheet"  />
<script type="text/javascript" src="../../js/util.js"></script>
<script type="text/javascript" src="../../js/new-ajax.js"></script>
<script type="text/javascript" src="../../js/admin-role-data.js"></script>
<script type="text/javascript">
function checkForm(frm){
	var role=frm['role'];
	if(role.value.trim().length<1){
		alert("请填写好角色");
		role.select();
		return false;
	}
	return true;
}
function initRoleList(obj,pid,step){
	for(var i=0;i<roleItems.length;i++){
		if(roleItems[i].pid==pid){
			obj.options[obj.options.length]=new Option(stepToSpace(step?step:0)+roleItems[i].role,roleItems[i].id,true,false);
			initRoleList(obj,roleItems[i].id,(step?step:0)+1);
		}
	}
}
function stepToSpace(step){
	var buffer="";
	for(var i=0;i<step;i++){
		buffer+="　　";//注意，这里使用了全角空格！
	}
	return buffer;
}
window.onload=function(){
	initRoleList(dqbb.$("parentRole"),0);
};
</script>
</head>
<body>
<form action="#" method="post" id="editForm" onsubmit="return checkForm(this)">
<table cellpadding="0" cellspacing="1" border="0" width="100%">
	<tr class="th">
		<td colspan="2">创建角色</td>
	</tr>
	<tr class="tb">
		<td width="80">上级角色：</td>
		<td><select name="parentRole" id="parentRole">
			<option></option>
		</select></td>
	</tr>
	<tr class="tb">
		<td width="80">上级角色：</td>
		<td><input type="text" size="70" name="role" id="role" /></td>
	</tr>
	<tr class="tb">
		<td>备注：</td>
		<td><textarea name="remark" id="remark" cols="80" rows="10"></textarea></td>
	</tr>
	<tr class="tf">
		<td colspan="2">
			<input type="submit" value="" class="submit"/>
			<input type="reset" value="" class="reset"/>
		</td>
	</tr>
</table>
</form>
</body>
</html>